﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AgilePlannerDT.Data.Impl
{
    class CardSizeSynchronizationDataObject : CardSizeSynchronization
    {
        long cardID;
        double width, height;

        public CardSizeSynchronizationDataObject():this(0,0,0){}


        public CardSizeSynchronizationDataObject(long id, double width, double height)
        {
            this.cardID = id;
            this.width = width;
            this.height = height;
        }


        #region CardSizeSynchronization Members

        public long CardID
        {
            get { return this.cardID; }
        }

        public double Width
        {
            get { return this.width; }
        }

        public double Height
        {
            get { return this.height; }
        }

        #endregion

        #region IXmlSerializable Members

        public System.Xml.Schema.XmlSchema GetSchema()
        {
            throw new NotImplementedException();
        }

        public void ReadXml(System.Xml.XmlReader reader)
        {
          
            this.width = Convert.ToDouble(reader.GetAttribute("CardWidth"));
            this.height = Convert.ToDouble(reader.GetAttribute("CardHeight"));
            this.cardID = (long)(Convert.ToDouble(reader.GetAttribute("CardID")));
        }

        public void WriteXml(System.Xml.XmlWriter writer)
        {
            writer.WriteStartElement("CardResize");
            writer.WriteAttributeString("CardWidth", this.width.ToString());
            writer.WriteAttributeString("CardHeight", this.height.ToString());
            writer.WriteAttributeString("CardID", this.cardID.ToString());
            writer.WriteEndElement();
        }

        #endregion
    }
}
